//  vuex 入口文件

import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import mutations from './mutations'
import * as getters from './getters'

import createLogger from 'vuex/dist/logger'

Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production'

const store = new Vuex.Store({
  state,
  mutations,
  getters,

  strict: debug,  //  是否开启严格模式，无论何时发生了状态变更且不是由 mutation 函数引起的，将会抛出错误
  plugins: debug ? [createLogger()] : []   //  日志插件
})

export default store